--EXTREMELY Toxic Floor, by Twins'R'Okay

--Time to give Sonic something that's probably 10x worse than Athlete's Foot :trollge: Based off of the damaging floors from the OG DOOM.

addHook("LinedefExecute", function(line, mobj, sector)
    if mobj.type == MT_PLAYER then
        if mobj.player.powers[pw_shield] == SH_ELEMENTAL or mobj.player.powers[pw_invulnerability] == true then return end --killswitch if the player has either the elemental shield or is invincible 
        mobj.player.toxictimer = $ or 0 --set this variable up first
        if P_IsObjectOnGround(mobj) then --are we on the ground?
            mobj.player.toxictimer = $ + 1 --if so, start the timer
            --print("The toxic timer is now"..mobj.player.toxictimer)
            if mobj.player.toxictimer == 8 and not (mobj.player.powers[pw_shield] == SH_BUBBLEWRAP) then --and hurt the player every 8 tics they're on the toxic floor
                if (mobj.player.rings <= 0)
                    --print("die")
                    P_KillMobj(mobj.player.mo) --fuck you lmao
                end
                mobj.player.rings = $ - 3
                S_StartSound(mobj, 162, player)
                mobj.player.toxictimer = 0 
            elseif mobj.player.toxictimer == 18 and (mobj.player.powers[pw_shield] == SH_BUBBLEWRAP) then --haha lmao i know nothing :)           -Twins~
                if(mobj.player.rings <= 0)
                    P_KillMobj(mobj.player.mo) --fuck you x2
                end
                mobj.player.rings = $ - 3
                S_StartSound(mobj, 162, player)
                S_StartSound(mobj, 375, player)
                mobj.player.toxictimer = 0
            end
        end
    else return end
end, "P_TOXIC")